home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.0 / PInterfaces / Fonts.p < prev    next >
Encoding:
Text File  |  1995-04-18  |  8.3 KB  |  311 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Fonts.p
  3.  
  4.      Contains:    Font Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT Fonts;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __FONTS__}
  30. {$SETC __FONTS__ := 1}
  31.  
  32. {$I+}
  33. {$SETC FontsIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __TYPES__}
  38. {$I Types.p}
  39. {$ENDC}
  40. {    ConditionalMacros.p                                            }
  41.  
  42. {$PUSH}
  43. {$ALIGN MAC68K}
  44. {$LibExport+}
  45.  
  46. CONST
  47.     systemFont                    = 0;
  48.     applFont                    = 1;
  49.     newYork                        = 2;
  50.     geneva                        = 3;
  51.     monaco                        = 4;
  52.     venice                        = 5;
  53.     london                        = 6;
  54.     athens                        = 7;
  55.     sanFran                        = 8;
  56.     toronto                        = 9;
  57.     cairo                        = 11;
  58.     losAngeles                    = 12;
  59.     times                        = 20;
  60.     helvetica                    = 21;
  61.     courier                        = 22;
  62.     symbol                        = 23;
  63.     mobile                        = 24;
  64.     commandMark                    = 17;
  65.     checkMark                    = 18;
  66.     diamondMark                    = 19;
  67.  
  68.     appleMark                    = 20;
  69.     propFont                    = 36864;
  70.     prpFntH                        = 36865;
  71.     prpFntW                        = 36866;
  72.     prpFntHW                    = 36867;
  73.     fixedFont                    = 45056;
  74.     fxdFntH                        = 45057;
  75.     fxdFntW                        = 45058;
  76.     fxdFntHW                    = 45059;
  77.     fontWid                        = 44208;
  78.  
  79.  
  80. TYPE
  81.     FMInput = PACKED RECORD
  82.         family:                    INTEGER;
  83.         size:                    INTEGER;
  84.         face:                    Style;
  85.         needBits:                BOOLEAN;
  86.         device:                    INTEGER;
  87.         numer:                    Point;
  88.         denom:                    Point;
  89.     END;
  90.  
  91.     FMOutput = PACKED RECORD
  92.         errNum:                    INTEGER;
  93.         fontHandle:                Handle;
  94.         boldPixels:                UInt8;
  95.         italicPixels:            UInt8;
  96.         ulOffset:                UInt8;
  97.         ulShadow:                UInt8;
  98.         ulThick:                UInt8;
  99.         shadowPixels:            UInt8;
  100.         extra:                    SInt8;
  101.         ascent:                    UInt8;
  102.         descent:                UInt8;
  103.         widMax:                    UInt8;
  104.         leading:                SInt8;
  105.         curStyle:                SInt8;
  106.         numer:                    Point;
  107.         denom:                    Point;
  108.     END;
  109.  
  110.     FMOutPtr = ^FMOutput;
  111.  
  112.     FontRec = RECORD
  113.         fontType:                INTEGER;                                {font type}
  114.         firstChar:                INTEGER;                                {ASCII code of first character}
  115.         lastChar:                INTEGER;                                {ASCII code of last character}
  116.         widMax:                    INTEGER;                                {maximum character width}
  117.         kernMax:                INTEGER;                                {negative of maximum character kern}
  118.         nDescent:                INTEGER;                                {negative of descent}
  119.         fRectWidth:                INTEGER;                                {width of font rectangle}
  120.         fRectHeight:            INTEGER;                                {height of font rectangle}
  121.         owTLoc:                    INTEGER;                                {offset to offset/width table}
  122.         ascent:                    INTEGER;                                {ascent}
  123.         descent:                INTEGER;                                {descent}
  124.         leading:                INTEGER;                                {leading}
  125.         rowWords:                INTEGER;                                {row width of bit image / 2 }
  126.     END;
  127.  
  128.     FMetricRec = RECORD
  129.         ascent:                    Fixed;                                    {base line to top}
  130.         descent:                Fixed;                                    {base line to bottom}
  131.         leading:                Fixed;                                    {leading between lines}
  132.         widMax:                    Fixed;                                    {maximum character width}
  133.         wTabHandle:                Handle;                                    {handle to font width table}
  134.     END;
  135.  
  136.     FMetricRecPtr = ^FMetricRec;
  137.     FMetricRecHandle = ^FMetricRecPtr;
  138.  
  139.     WidEntry = RECORD
  140.         widStyle:                INTEGER;                                {style entry applies to}
  141.     END;
  142.  
  143.     WidTable = RECORD
  144.         numWidths:                INTEGER;                                {number of entries - 1}
  145.     END;
  146.  
  147.     AsscEntry = RECORD
  148.         fontSize:                INTEGER;
  149.         fontStyle:                INTEGER;
  150.         fontID:                    INTEGER;                                {font resource ID}
  151.     END;
  152.  
  153.     FontAssoc = RECORD
  154.         numAssoc:                INTEGER;                                {number of entries - 1}
  155.     END;
  156.  
  157.     StyleTable = RECORD
  158.         fontClass:                INTEGER;
  159.         offset:                    LONGINT;
  160.         reserved:                LONGINT;
  161.         indexes:                PACKED ARRAY [0..47] OF CHAR;
  162.     END;
  163.  
  164.     NameTable = RECORD
  165.         stringCount:            INTEGER;
  166.         baseFontName:            Str255;
  167.     END;
  168.  
  169.     KernPair = RECORD
  170.         kernFirst:                CHAR;                                    {1st character of kerned pair}
  171.         kernSecond:                CHAR;                                    {2nd character of kerned pair}
  172.         kernWidth:                INTEGER;                                {kerning in 1pt fixed format}
  173.     END;
  174.  
  175.     KernEntry = RECORD
  176.         kernStyle:                INTEGER;                                {style the entry applies to}
  177.         kernLength:                INTEGER;                                {length of this entry}
  178.     END;
  179.  
  180.     KernTable = RECORD
  181.         numKerns:                INTEGER;                                {number of kerning entries}
  182.     END;
  183.  
  184.     WidthTable = PACKED RECORD
  185.         tabData:                ARRAY [0..255] OF Fixed;                {character widths}
  186.         tabFont:                Handle;                                    {font record used to build table}
  187.         sExtra:                    LONGINT;                                {space extra used for table}
  188.         style:                    LONGINT;                                {extra due to style}
  189.         fID:                    INTEGER;                                {font family ID}
  190.         fSize:                    INTEGER;                                {font size request}
  191.         face:                    INTEGER;                                {style (face) request}
  192.         device:                    INTEGER;                                {device requested}
  193.         inNumer:                Point;                                    {scale factors requested}
  194.         inDenom:                Point;                                    {scale factors requested}
  195.         aFID:                    INTEGER;                                {actual font family ID for table}
  196.         fHand:                    Handle;                                    {family record used to build up table}
  197.         usedFam:                BOOLEAN;                                {used fixed point family widths}
  198.         aFace:                    UInt8;                                    {actual face produced}
  199.         vOutput:                INTEGER;                                {vertical scale output value}
  200.         hOutput:                INTEGER;                                {horizontal scale output value}
  201.         vFactor:                INTEGER;                                {vertical scale output value}
  202.         hFactor:                INTEGER;                                {horizontal scale output value}
  203.         aSize:                    INTEGER;                                {actual size of actual font used}
  204.         tabSize:                INTEGER;                                {total size of table}
  205.     END;
  206.  
  207.     FamRec = RECORD
  208.         ffFlags:                INTEGER;                                {flags for family}
  209.         ffFamID:                INTEGER;                                {family ID number}
  210.         ffFirstChar:            INTEGER;                                {ASCII code of 1st character}
  211.         ffLastChar:                INTEGER;                                {ASCII code of last character}
  212.         ffAscent:                INTEGER;                                {maximum ascent for 1pt font}
  213.         ffDescent:                INTEGER;                                {maximum descent for 1pt font}
  214.         ffLeading:                INTEGER;                                {maximum leading for 1pt font}
  215.         ffWidMax:                INTEGER;                                {maximum widMax for 1pt font}
  216.         ffWTabOff:                LONGINT;                                {offset to width table}
  217.         ffKernOff:                LONGINT;                                {offset to kerning table}
  218.         ffStylOff:                LONGINT;                                {offset to style mapping table}
  219.         ffProperty:                ARRAY [0..8] OF INTEGER;                {style property info}
  220.         ffIntl:                    ARRAY [0..1] OF INTEGER;                {for international use}
  221.         ffVersion:                INTEGER;                                {version number}
  222.     END;
  223.  
  224.  
  225. PROCEDURE InitFonts;
  226.     {$IFC NOT GENERATINGCFM}
  227.     INLINE $A8FE;
  228.     {$ENDC}
  229. PROCEDURE GetFontName(familyID: INTEGER; VAR name: Str255);
  230.     {$IFC NOT GENERATINGCFM}
  231.     INLINE $A8FF;
  232.     {$ENDC}
  233. PROCEDURE GetFNum(name: ConstStr255Param; VAR familyID: INTEGER);
  234.     {$IFC NOT GENERATINGCFM}
  235.     INLINE $A900;
  236.     {$ENDC}
  237. FUNCTION RealFont(fontNum: INTEGER; size: INTEGER): BOOLEAN;
  238.     {$IFC NOT GENERATINGCFM}
  239.     INLINE $A902;
  240.     {$ENDC}
  241. PROCEDURE SetFontLock(lockFlag: BOOLEAN);
  242.     {$IFC NOT GENERATINGCFM}
  243.     INLINE $A903;
  244.     {$ENDC}
  245. FUNCTION FMSwapFont({CONST}VAR inRec: FMInput): FMOutPtr;
  246.     {$IFC NOT GENERATINGCFM}
  247.     INLINE $A901;
  248.     {$ENDC}
  249. PROCEDURE SetFScaleDisable(fscaleDisable: BOOLEAN);
  250.     {$IFC NOT GENERATINGCFM}
  251.     INLINE $A834;
  252.     {$ENDC}
  253. PROCEDURE FontMetrics(theMetrics: FMetricRecPtr);
  254.     {$IFC NOT GENERATINGCFM}
  255.     INLINE $A835;
  256.     {$ENDC}
  257. PROCEDURE SetFractEnable(fractEnable: BOOLEAN);
  258. FUNCTION GetDefFontSize: INTEGER;
  259.     {$IFC NOT GENERATINGCFM}
  260.     INLINE $3EB8, $0BA8, $6604, $3EBC, $000C;
  261.     {$ENDC}
  262. FUNCTION IsOutline(numer: Point; denom: Point): BOOLEAN;
  263.     {$IFC NOT GENERATINGCFM}
  264.     INLINE $7000, $A854;
  265.     {$ENDC}
  266. PROCEDURE SetOutlinePreferred(outlinePreferred: BOOLEAN);
  267.     {$IFC NOT GENERATINGCFM}
  268.     INLINE $7001, $A854;
  269.     {$ENDC}
  270. FUNCTION GetOutlinePreferred: BOOLEAN;
  271.     {$IFC NOT GENERATINGCFM}
  272.     INLINE $7009, $A854;
  273.     {$ENDC}
  274. FUNCTION OutlineMetrics(byteCount: INTEGER; textPtr: UNIV Ptr; numer: Point; denom: Point; VAR yMax: INTEGER; VAR yMin: INTEGER; awArray: FixedPtr; lsbArray: FixedPtr; boundsArray: RectPtr): OSErr;
  275.     {$IFC NOT GENERATINGCFM}
  276.     INLINE $7008, $A854;
  277.     {$ENDC}
  278. PROCEDURE SetPreserveGlyph(preserveGlyph: BOOLEAN);
  279.     {$IFC NOT GENERATINGCFM}
  280.     INLINE $700A, $A854;
  281.     {$ENDC}
  282. FUNCTION GetPreserveGlyph: BOOLEAN;
  283.     {$IFC NOT GENERATINGCFM}
  284.     INLINE $700B, $A854;
  285.     {$ENDC}
  286. FUNCTION FlushFonts: OSErr;
  287.     {$IFC NOT GENERATINGCFM}
  288.     INLINE $700C, $A854;
  289.     {$ENDC}
  290. FUNCTION GetSysFont : INTEGER;
  291.     {$IFC NOT CFMSYSTEMCALLS}
  292.     INLINE $3EB8, $0BA6;            { MOVE.w $0BA6,(SP) }
  293.     {$ENDC}
  294.  
  295. FUNCTION GetAppFont : INTEGER;
  296.     {$IFC NOT CFMSYSTEMCALLS}
  297.     INLINE $3EB8, $0984;            { MOVE.w $0984,(SP) }
  298.     {$ENDC}
  299.  
  300.  
  301. {$ALIGN RESET}
  302. {$POP}
  303.  
  304. {$SETC UsingIncludes := FontsIncludes}
  305.  
  306. {$ENDC} {__FONTS__}
  307.  
  308. {$IFC NOT UsingIncludes}
  309.  END.
  310. {$ENDC}
  311.